﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json.Linq;
using System.Web.Script.Serialization;
using System.IO;

namespace WebBHXH.Entities
{
    public class MaBHYTTNModel
    {
        public MaBHYTTNModel() 
        {
            
        }

        public MaBHYTTNModel(string json)
        {
            JObject jObject = JObject.Parse(json);
            maBHYTTN = (string)jObject["Ma_BHYTTN"];
            maDotBH = (string)jObject["Ma_DotBH"];
            HoVaTen = (string)jObject["HoVaTen"];
            NgaySinh = (DateTime)jObject["NgaySinh"];
            GioiTinh = (string)jObject["GioiTinh"];
            DiaChi = (string)jObject["DiaChi"];
            CoSoKCB = (string)jObject["Ma_CoSoKCB"];
            TuNgay = (DateTime)jObject["TuNgay"];
            DenNgay = (DateTime)jObject["DenNgay"];
            LoaiBH = (string)jObject["Ma_LoaiBH"];
            MucBH = (string)jObject["Ma_MucBH"];
            NgayDangKy = new DateTime();
            NgayCapThe = (DateTime)jObject["NgayCapThe"];
            TinhTrang = (int)jObject["TinhTrang"];
            GhiChu = (string)jObject["GhiChu"];
            DonViBHSTT = (int)jObject["DonViBH_STT"];
            MaSoThe = (string)jObject["MaSoThe"];
            NguoiSudung = (string)jObject["Ma_NSD"];
            NgayTaoMoi = (DateTime)jObject["NgayTaoMoi"];
            NgayCapNhat = new DateTime();

        }

        public MaBHYTTNModel GetBHYTTNById(string id)
        { 
            System.Net.WebRequest request = System.Net.WebRequest.Create(""+Util.getUrl() + "Home/GetBHYTTNById?id=" + id);
            request.Method = "POST";
            request.ContentLength = 0;
            request.ContentType = "application/json; charset=utf-8";
            JavaScriptSerializer json_serializer = new JavaScriptSerializer();

            using (Stream s = request.GetResponse().GetResponseStream())
            {
                using (StreamReader sr = new StreamReader(s))
                {
                    JavaScriptSerializer jsonserializer = new JavaScriptSerializer();
                    MaBHYTTNModel BHYTTN = jsonserializer.Deserialize<MaBHYTTNModel>(sr.ReadToEnd());
                    return BHYTTN;
                }
            }

            return new MaBHYTTNModel();
        }
        private string maBHYTTN;

        public string MaBHYTTN
        {
            get { return maBHYTTN; }
            set { maBHYTTN = value; }
        }

        private string maDotBH;

        public string MaDotBH
        {
            get { return maDotBH; }
            set { maDotBH = value; }
        }

        private string hoVaTen;

        public string HoVaTen
        {
            get { return hoVaTen; }
            set { hoVaTen = value; }
        }
        private DateTime ngaySinh;

        public DateTime NgaySinh
        {
            get { return ngaySinh; }
            set { ngaySinh = value; }
        }
        private string gioiTinh;

        public string GioiTinh
        {
            get { return gioiTinh; }
            set { gioiTinh = value; }
        }
        private string diaChi;

        public string DiaChi
        {
            get { return diaChi; }
            set { diaChi = value; }
        }
        private string coSoKCB;

        public string CoSoKCB
        {
            get { return coSoKCB; }
            set { coSoKCB = value; }
        }
        private DateTime tuNgay;

        public DateTime TuNgay
        {
            get { return tuNgay; }
            set { tuNgay = value; }
        }
        private DateTime denNgay;

        public DateTime DenNgay
        {
            get { return denNgay; }
            set { denNgay = value; }
        }
        private string loaiBH;

        public string LoaiBH
        {
            get { return loaiBH; }
            set { loaiBH = value; }
        }
        private string mucBH;

        public string MucBH
        {
            get { return mucBH; }
            set { mucBH = value; }
        }
        private DateTime ngayDangKy;

        public DateTime NgayDangKy
        {
            get { return ngayDangKy; }
            set { ngayDangKy = value; }
        }
        private DateTime ngayCapThe;

        public DateTime NgayCapThe
        {
            get { return ngayCapThe; }
            set { ngayCapThe = value; }
        }
        private int tinhTrang;

        public int TinhTrang
        {
            get { return tinhTrang; }
            set { tinhTrang = value; }
        }
        private string ghiChu;

        public string GhiChu
        {
            get { return ghiChu; }
            set { ghiChu = value; }
        }
        private int donViBHSTT;

        public int DonViBHSTT
        {
            get { return donViBHSTT; }
            set { donViBHSTT = value; }
        }
        private string maSoThe;

        public string MaSoThe
        {
            get { return maSoThe; }
            set { maSoThe = value; }
        }
        private string nguoiSudung;

        public string NguoiSudung
        {
            get { return nguoiSudung; }
            set { nguoiSudung = value; }
        }
        private DateTime ngayTaoMoi;

        public DateTime NgayTaoMoi
        {
            get { return ngayTaoMoi; }
            set { ngayTaoMoi = value; }
        }
        private DateTime ngayCapNhat;

        public DateTime NgayCapNhat
        {
            get { return ngayCapNhat; }
            set { ngayCapNhat = value; }
        }

    }
}